<template>
  <div style="" v-if="warnList">
    <el-table :data="warnList" style="width: 100%" height="100px" v-adaptive>
      <el-table-column prop="assetName" label="网关名称"> </el-table-column>
      <el-table-column prop="deviceId" label="设备类型"> </el-table-column>
      <el-table-column prop="deviceId" label="设备名称"> </el-table-column>
      <el-table-column prop="eventType" label="警告点位"> </el-table-column>
      <el-table-column prop="message" label="警告描述"> </el-table-column>
      <el-table-column prop="eventDate" label="开始时间">
        <template slot-scope="scope">
          {{ formatDateT(scope.row.eventDate) }}
        </template>
      </el-table-column>
      <el-table-column prop="receivedDate" label="接收时间">
        <template slot-scope="scope">
          {{ formatDateT(scope.row.receivedDate) }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    warnList: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {};
  },
  mounted() {},
  methods: {
    indexMethod(index) {
      return index;
    },
    // 时间格式转换
    formatDateT(date) {
      if (date === undefined) {
        return "N/A";
      }
      return this.$moment(new Date(date)).format("YYYY-MM-DD H:mm:ss");
    },
  },
};
</script>

<style>
</style>
